package com.idbk.chargestation.bll.pile;


import android.content.Context;

import com.idbk.chargestation.R;

/**
 * 电桩 供应商对于的工具类
 * @author lupc
 *
 */
public class PileVendors {

	private Context mContext;

	/**
	 * 供应商对应的  id
	 */
	private final static int[] mVendorIds = new int[]{
			1,3,4,5,6,7,8,9,11,12,13,14,15
	};

	/**
	 * 供应商对应的  名称
	 */
	private final String[] mVendorNames;

	/**
	 * 过滤器 专用的 供应商名称列表
	 */
	private final String[] mFilterVendorNames;

	/**
	 * 供应商id及其 对应的 过滤器显示图标
	 */
	private final static int[][] mFilterVendors = new int[][]{
			{1, R.drawable.ico_filter_logo_other_active,R.drawable.ico_filter_logo_other_normal},
			{3,R.drawable.ico_filter_logo_yfb_active,R.drawable.ico_filter_logo_yfb_normal},
			{4,R.drawable.ico_filter_logo_cdw_active,R.drawable.ico_filter_logo_cdw_normal},
			{5,R.drawable.ico_filter_logo_tsl_active,R.drawable.ico_filter_logo_tsl_normal},
			{6,R.drawable.ico_filter_logo_tld_active,R.drawable.ico_filter_logo_tld_normal},
			{7,R.drawable.ico_filter_logo_zgpt_active,R.drawable.ico_filter_logo_zgpt_normal},
			{8,R.drawable.ico_filter_logo_gjdw_active,R.drawable.ico_filter_logo_gjdw_normal},
			{9,R.drawable.ico_filter_logo_ycw_active,R.drawable.ico_filter_logo_ycw_normal},
			{11,R.drawable.ico_filter_logo_ts_active,R.drawable.ico_filter_logo_ts_normal},
			{12,R.drawable.ico_filter_logo_cddz_active,R.drawable.ico_filter_logo_cddz_normal},
			{13,R.drawable.ico_filter_logo_jdz_active,R.drawable.ico_filter_logo_jdz_normal},
			{14,R.drawable.ico_filter_logo_dz_active,R.drawable.ico_filter_logo_dz_normal},
			{15,R.drawable.ico_filter_logo_other_active,R.drawable.ico_filter_logo_other_normal},
	};

	/**
	 * 高德地图上显示的充电点图标
	 */
	private final static int[][] mMarkerVendors = new int[][]{
			{0,R.drawable.ico_map_marker_ydz},
			{1,R.drawable.ico_map_marker_personal},
			{2,R.drawable.ico_map_marker_tld},//易电桩图标
			{3,R.drawable.ico_map_marker_tld},//这个是非标版本才有意义
			{4,R.drawable.ico_map_marker_cdw},
			{5,R.drawable.ico_map_marker_tsl},
			{6,R.drawable.ico_map_marker_tld},
			{7,R.drawable.ico_map_marker_zgpt},
			{8,R.drawable.ico_map_marker_gjdw},
			{9,R.drawable.ico_map_marker_ycw},
			{10,R.drawable.ico_map_marker_tld},//这个废弃
			{11,R.drawable.ico_map_marker_ts},
			{12,R.drawable.ico_map_marker_cddz},
			{13,R.drawable.ico_map_marker_jdw},
			{14,R.drawable.ico_map_marker_dz},
			{15,R.drawable.ico_map_marker_other},
	};

	/**
	 * 特殊id 表示官方
	 */
	public final static int OFFICAL = 0;

	public final static int PERSONAL = 1;

	public final static int YI_DIAN_ZHUANG = 2;

	/**
	 * 代理商版本的时候，使用此id，表示官方
	 */
	public final static int YUE_FANG_BIAN = 3;
	public final static int AGENT = YUE_FANG_BIAN;

	public final static int CHONG_DIAN_WANG = 4;

	public final static int TESILA = 5;

	public final static int TE_LAI_DIAN = 6;

	public final static int ZHONG_GUO_PU_TIAN = 7;

	public final static int NATIONAL_GRID = 8;

	public final static int YI_CHONG_WANG = 9;

	public final static int DONG_FENG_RI_CHAN = 10;

	public final static int TENG_SHI = 11;

	public final static int CHONG_DIAN_DUI_ZHANG = 12;

	public final static int JU_DIAN_ZHUANG = 13;

	public final static int BEI_JING_DIAN_ZHUANG = 14;

	public final static int OTHER = 15;

	public PileVendors(Context context){
		mContext = context;

		mVendorNames = mContext.getResources().getStringArray(R.array.pile_vendor_names);

		mFilterVendorNames = mContext.getResources().getStringArray(R.array.filter_vendor_names);
	}

	public String getPileVendorNameById(int id){
		int index = 0;
		for (int i = 0; i < mVendorIds.length; i++) {
			if(mVendorIds[i] == id){
				index = i;
				break;
			}
		}
		return mVendorNames[index];
	}

	public String getPileVendorNameByPosition(int position){
		return mVendorNames[position];
	}

	public int[] getPileVendorIds(){
		return mVendorIds;
	}

	/*------------ 过滤器专用函数 开始--------------------*/

	public int getFilterVendorCount(){
		return mFilterVendors.length;
	}

	public int getFilterVendorLogo(int position, boolean isActive){
		return isActive? mFilterVendors[position][1] : mFilterVendors[position][2];
	}

	public int getFilterVendorId(int position){
		return mFilterVendors[position][0];
	}

	public String getFilterVendorName(int position){
		return mFilterVendorNames[position];
	}

	/*------------ 过滤器专用函数 结束--------------------*/

	/*------------ 地图marker专用函数 开始--------------------*/

	/**
	 * 获取地图marker点的图标
	 * @param vendorId 供应商id
	 * @return
	 */
	public int getMarkerIcon(int vendorId){
		if(vendorId < 0 || vendorId > 15){
			return R.drawable.ico_map_marker_ydz;
		} else {
			return mMarkerVendors[vendorId][1];
		}
	}
	
	
	/*------------ 地图marker专用函数 结束--------------------*/

}
